/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kleintjes.creational.factory_pattern.example_book1.factory;

import com.kleintjes.creational.factory_pattern.example_book1.Connection;
import com.kleintjes.creational.factory_pattern.example_book1.model.MySqlConnection;
import com.kleintjes.creational.factory_pattern.example_book1.model.OracleConnection;
import com.kleintjes.creational.factory_pattern.example_book1.model.SQLServerConnection;

/**
 *
 * @author Hughan.Kleintjes.hughanK@gmail.com
 */
public class FirstFactory 
{
    protected String type;
    
    public FirstFactory(String type)
    {
        this.type = type;
    }
    
    public Connection creatConnection()
    {
        if( type.equals("Oracle") )
            return new OracleConnection();
        else if ( type.equals("SQL Server") )
            return new SQLServerConnection();
        else
            return new MySqlConnection();
    }
    
    
    
}
